This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
~Hank Chufanaskiettu 28.Jan.04 01:08 PM a Web browser Applications Development6.5All Platforms
Hi there,
I try to send some email as MIME. I have the HTML text stored in a field and use the agent code below. When I send the message to a Notes or Yahoo user (this is where I tested it) the content type shows text/html. If I inspect the Body Properties in Notes the full HTML is there. However neither in Notes nor yahoo the HTML tags are rendered. I'm very clueless what I miss out. Any help?
:-) stw
The function:
Sub MailThisDoc(mdb As NotesDatabase, doc As NotesDocument)
'Sends a copy of the document, rendered as HTML
Dim mDoc As NotesDocument
Dim mBody As NotesItem 'item
Dim mHTMLBody As NotesItem 'HTML Version of Body
Dim body As NotesMIMEEntity
Dim header As NotesMIMEHeader
Dim stream As NotesStream
Dim s As New NotesSession
On Error Goto Err_MailThisDoc
Set mDoc = New NotesDocument(mdb)
Set stream = s.CreateStream
Set mHTMLBody = doc.GetFirstItem("BodyHTML")
'All header information
Set body = mDoc.CreateMIMEEntity
'I also uncommented that, but it didn't help
'Set header = body.CreateHeader("Subject")
'Call header.SetHeaderVal(doc.Subject(0))
'Set header = body.CreateHeader("To")
'Call header.SetHeaderVal(doc.SendTo(0))
'Set header = body.CreateHeader("From")
'Call header.SetHeaderVal(doc.From(0))
'Set header = body.CreateHeader("Content-Type")
'Call header.SetHeaderVal("text/html")
Forall hbv In mHTMLBody.Values
Call stream.WriteText(hbv,EOL_PLATFORM)
End Forall
Call body.SetContentFromText(stream,"text/html", ENC_NONE)
'Save the MIME - Comment/Uncomment - no difference
'Call mDoc.CloseMIMEEntities(True)
'Populate "normal" fields
mDoc.Form = "Memo"
mDoc.From = doc.From
mDoc.Subject = doc.Subject
mDoc.SendTo = doc.SendTo
mDoc.Recipients = doc.SendTo
Call mDoc.Save(True, True)
'Save/No Save no difference
Call mDoc.Send(False)
'I don't need it
Call mDoc.Remove(True)
Exit_MailThisDoc:
Exit Sub
Err_MailThisDoc:
Print "Error in MailThisDoc "
Print Err
Print Error$
Resume Exit_MailThisDoc
End Sub